<html>
<head><meta charset="utf-8"><title>Adding an intrinsic · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Adding.20an.20intrinsic.html">Adding an intrinsic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="201030969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Adding%20an%20intrinsic/near/201030969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Adding.20an.20intrinsic.html#201030969">(Jun 16 2020 at 15:19)</a>:</h4>
<p>Locally, I've added an intrinsic for determining the number of variants in an <code>enum</code> (<code>mem::variants&lt;T&gt;()</code>) and I've got a use case in <code>rustc</code>, what's the process regarding issues/RFCs/MCPs etc if I want to try and get it into nightly?</p>



<a name="201034924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Adding%20an%20intrinsic/near/201034924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Adding.20an.20intrinsic.html#201034924">(Jun 16 2020 at 15:47)</a>:</h4>
<p>Just send a PR, intrinsics in <code>core::intrinsics</code> are always unstable so there are no stability issues. If you want to expose the intrinsic in <code>core::mem</code> then I think it can still be done with just a PR, but it will require an FCP to stablize.</p>



<a name="201035134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Adding%20an%20intrinsic/near/201035134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Corbyn <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Adding.20an.20intrinsic.html#201035134">(Jun 16 2020 at 15:48)</a>:</h4>
<p>Ok thanks!</p>



<a name="201036099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Adding%20an%20intrinsic/near/201036099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Adding.20an.20intrinsic.html#201036099">(Jun 16 2020 at 15:55)</a>:</h4>
<p>Also minor bikeshed, I think <code>num_variants</code> would be a better name.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>